package router

import (
	"github.com/gin-gonic/gin"
)

type router interface {
	init(engine *gin.Engine)
}

var routers = []router{
	new(activity),
}

func NewEngine() *gin.Engine {

	//gin.SetMode(config.Env)

	engine := gin.New()
	engine.Use(gin.Logger())

	engine.NoRoute(func(c *gin.Context) {
		c.JSON(404, gin.H{"code": "404", "message": "Page not found"})
	})

	engine.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "pong",
		})
	})

	for _, router := range routers {
		router.init(engine)
	}

	return engine
}